<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery.min.js"></script>
    <script>
        $(document).ready(function () {

            $("#kill").click(function () {
                //1、建立websocket连接
                let url ="WS://localhost:8080/woniuchat/zs"
                let ws = new WebSocket(url);
                //
                ws.onmessage=function (result) {
                    //判断成功、失败
                    console.log(result)
                    //1、关闭ws
                    ws.close();
                    //2、跳转页面、发送请求做支付页面
                    //window.location.href="order.html?orderid="
                }
                //2、发送秒杀请求
                $.ajax({
                    url:"/kill?userName=zs",
                    success:function (result) {
                        console.log(result);

                    }
                })
            });

        });
    </script>
</head>
<body>
<button id="kill">抢购</button>
</body>
</html>